package cn.mazexal.examapi.generateData;

import cn.mazexal.examapi.models.vo.BannerItemVO;
import cn.mazexal.examapi.utils.RandomUtils;
import com.alibaba.fastjson2.JSON;
import lombok.Data;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: Mazexal
 * Date: 2025/5/12
 */

public class ConfigData {

    @Test
    public void generateBannerData() {
        BannerItemVO res = new BannerItemVO();
        res.setTitle("taobao");
        res.setImageUrl("https://img1.baidu.com/it/u=3620303268,2920355642&fm=253&app=138&f=JPEG?w=1099&h=800");
        res.setLinkUrl("https://www.taobao.com");

        BannerItemVO res2 = new BannerItemVO();
        res2.setTitle("baidu");
        res2.setImageUrl("https://bkimg.cdn.bcebos.com/pic/dbb44aed2e738bd46496bda7a18b87d6267ff9f5");
        res2.setLinkUrl("https://www.baidu.com");

        List<BannerItemVO> arr = List.of(res, res2);
        System.out.println(JSON.toJSONString(arr));
    }

    @Test
    public void testRandom() {
        for (int i = 0; i < 100; i++) {
            System.out.println(RandomUtils.getRandomNum(1, 2));
        }
    }


    @Test
    public void testListRemoveALl() {
        List<Integer> immutableList = List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);

// 转换为可变集合（支持修改）
        List<Integer> mutableList = new ArrayList<>(immutableList);

// 安全移除所有元素
        mutableList.removeAll(List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)); // 正常执行，无异常

    }

    @Test
    public void versionTest() {
        String version = "1.0.0";
        version = version.replaceAll("\\.", "");
        System.out.println(Integer.parseInt(version));
    }


}
